package com.xunwulian.cmpp.pdu;


import com.google.gson.Gson;
import com.xunwulian.base.util.GsonUtil;
import com.xunwulian.cmpp.sms.ByteBuffer;
import com.xunwulian.cmpp.sms.PDUException;
import com.xunwulian.cmpp.util.CmppConstant;

import java.io.Serializable;

public class Terminate extends Request implements Serializable {

    private static final long serialVersionUID = -2326781452245061935L;

    public Terminate() {
        super(CmppConstant.CMD_TERMINATE);
    }

    /*
     * (non-Javadoc)
     * 
     * @see cmpp.smgp.pdu.Request#createResponse()
     */
    protected Response createResponse() {
        return new TerminateResp();
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.main.cmpp.sms.ByteData#setData(java.main.cmpp.sms.util.ByteBuffer)
     */
    public void setData(ByteBuffer buffer) throws PDUException {
        header.setData(buffer);

    }

    /*
     * (non-Javadoc)
     * 
     * @see java.main.cmpp.sms.ByteData#getData()
     */
    public ByteBuffer getData() {
        return header.getData();
    }

    public String name() {
        return "CMPP Terminate";
    }

    public String dump() {
        return GsonUtil.toJson(this, this.getClass());
    }
}
